package com.example.demo01.controller;

import com.example.demo01.entity.Infor;
import com.example.demo01.entity.Middle;
import com.example.demo01.mapper.InforMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
@Api(tags="infor")
@RestController
@EnableSwagger2
public class InforController {
    @Autowired
    private InforMapper inforMapper;
    @ApiOperation(value = "人员表查询时间")
    @GetMapping("/getAllInfor")
    public List<Infor> getAll(String starttime, String endtime){

        return inforMapper.getAll(starttime,endtime);
    }
    @ApiOperation(value = "人员信息删除")
    @GetMapping("/deleteInfor")
    public int delete(int id){
        return inforMapper.delete(id);
    }
    @ApiOperation(value = "人员模糊查询")
    @GetMapping("/getname")
    public List<Infor> getname(String names){
        return inforMapper.getname(names);
    }
    @ApiOperation(value = "人员添加信息")
    @GetMapping("/addInfor")
    public int AddUser(Infor infor){
        if (infor!=null){
            if (infor.getId()!=0){

            }
        }
        return inforMapper.insertInfor(infor);
    }
//    显示列表：角色名称、此角色下共计人数
@ApiOperation(value = "人员显示列表")
@GetMapping("/getname2")
public List<Middle> getname2(String names, String email, String rolename, Date createtime){
    return inforMapper.getname2(names,email,rolename,createtime);
}
    @ApiOperation(value = "人员更改操作")
    @GetMapping("/update1")
public int updates(int id,String names,String password,String email){
    return inforMapper.updates(id,names,password,email);
}
}
